package admincow.servlet.regevabe;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import admincow.dao.RegevabeDAO;
import admincow.vo.RegevabeVO;

/**
 * Servlet implementation class for Servlet: RegevabeEditarServlet
 *
 */
 public class RegevabeEditarServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
   static final long serialVersionUID = 1L;
   
    /* (non-Java-doc)
	 * @see javax.servlet.http.HttpServlet#HttpServlet()
	 */
	public RegevabeEditarServlet() {
		super();
	}   	
	 
	/* (non-Java-doc)
	 * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String x = request.getParameter("becerro");
		String y = request.getParameter("vaca");
		System.out.println("Que pasa, si soy un mounstruo en computacion");
		
		System.out.println(x);
		System.out.println(y);
		
		if(x!=null){
			System.out.println("Entrando al evento Becerro");
			RegevabeDAO dao = new RegevabeDAO();
			RegevabeVO vo = dao.obtenerb(x);
			request.setAttribute("becerron", vo);	
		}
		if(y!=null){
			System.out.println(" Entrando al Evento vaca");
			RegevabeDAO dao = new RegevabeDAO();
			RegevabeVO vo = dao.obtenerv(y);
			request.setAttribute("becerron", vo);
			//cambie becerro*becerron-----vaca*becerron
		}

		RequestDispatcher rd = request
				.getRequestDispatcher("/regevabeEditar.jsp");
		rd.forward(request, response);
	}  	
	
	/* (non-Java-doc)
	 * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}   	  	    
}